<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${ctx}/css/sapar.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/sapar.js"></script>
<script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
<script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/js/kkpager.min.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/css/kkpager_blue.css" />
<title>一起灭菌的包</title>
<style>

#shushu{
font-weight:bold;
}
</style>
</head>

<body>
    <div id="saper-container">
        <div id="saper-hd"></div>
        <div id="saper-bd">
            <div class="subfiled clearfix">
                <h2>一起灭菌的包</h2>
            </div>
            <div class="subfiled-content">
                
                

                <!--表格开始-->
                <div class="table">
                    <!--表格操作-->
                    
                    <!--表格具体内容-->
                    <div class="table-box">
                        <table>
                            <thead>
                                <tr>
                                  <!-- <th><input type="checkbox"/></th> -->
                                 
								  <th class="text-left">灭菌流水</th>  
			                      <th class="text-left">包条码</th>  
			    				  <th class="text-left">包名称</th>
			    				  <!-- <th class="text-left">物品尺寸</th>
			    				  <th class="text-left">物品规格</th>
			    				  <th class="text-left">物品功能</th> -->
			    				    
                                </tr>
                            </thead>
                            <tbody>
                            	<c:if test="${miejunbao != null}">
                            	<c:forEach items="${miejunbao}" var="miejunbao">
                                <tr>
									<%-- <td><input type="checkbox" name="key" value="${qixie.productId}"/></td> --%>
									<!-- <td><input type="text" size="5" name="searchTxt" placeholder="输入数量"  class="shuliang" id="shushu"></td> -->
									<td>${miejunbao.miejunLiushui}</td>
									<td>${miejunbao.packageTiaoma}</td>
									<td>${miejunbao.packageName }</td>
									
									<%-- <td>${qixie.productPic}</td> --%>
                                </tr>
                                </c:forEach>
                                </c:if>
                            </tbody>
                        </table>
                    </div>
                </div><!--表格结束-->
            </div>
        </div>
        <div id="saper-ft">
       	 	<div id="kkpager"></div>
        </div>
    </div>
    
</body>

<script type="text/javascript">
var productJson = ${productJson};
var arra = [] ;
	$(function(){
		var totalPage = ${total};
		var pageNo = getParameter('pageIndex');
		if(!pageNo){
			pageNo = 1;
		}
		//生成分页
		//有些参数是可选的，比如lang，若不传有默认值
		kkpager.generPageHtml({
			pno : pageNo,
			//总页码
			total : totalPage,
			//链接前部
			hrefFormer : '${ctx}/shoushumuban/qixieDetailList',
			//链接尾部
			hrefLatter : '.do',
			getLink : function(n){
				return this.hrefFormer + this.hrefLatter + "?pageIndex="+n+"&searchTxt="+$(".search_text").val();
			}
		});
		
		$(".query-btn").click(function(){
			window.location.href="${ctx}/shoushumuban/qixieDetailList.do?id="+$(".search_text").val();
		});
		
		/* $(".add").click(function(){
			window.location.href="${ctx}/qixie/qixieEdit.do";
		});
		 */
		/* $(".add").click(function(){
			var chk_value = getSelRecord();
			if(chk_value.length == 1){
				window.location.href="${ctx}/qixie/qixieEdit.do?id="+chk_value[0];
			}else{
				layer.msg("请选择并只能选择一条数据！");
			}
		}); */
		
		<%--点添加到手术包用到的事件--%>
		$(".add").click(function(){
			var chk_value = getSelRecord();
			var index = parent.layer.getFrameIndex(window.name);
			if(chk_value.length > 0){
				 console.log(arra);
				 <%--父页面调用回调--%>
				 parent.callbackData(arra);
			}else{
				layer.msg('请选择要添加的数据！');
			}
			
		});
	});
<%--找到所有选择的数据--%>
	function getSelRecord(){
		var chk_value =[];
		$('input[name="key"]:checked').each(function(){
			chk_value.push($(this).val());
			var key = $(this).val()+"";
			var tempObj = productJson[key];
			arra.push(tempObj);
		});
		return chk_value;
	}  
	
  	function getParameter(name) { 
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r!=null) return unescape(r[2]); return null;
	}
</script>
</html>